<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<!DOCTYPE html>
<html>
	<head>
		<title>编辑早教中心</title>
		<meta name="decorator" content="default"/>
		<script type="text/javascript">
			$(function() {
				//初始化表单验证
				$("#inputForm").initValidform();
			});
			
			function getCity(){
				var proviceid = $("#province option:selected").val();
	            $.post("${ctx}/sys/area/ajax?method=getchilds", { "parentid": proviceid },function (result) {
                    if (result != "") {
                        $("#city").html(result);
                        $('.rule-single-select').ruleSingleSelect();
                   	}
                }, "text");
			}
			
			function getArea(){
				var proviceid = $("#city option:selected").val();
	            $.post("${ctx}/sys/area/ajax?method=getarea", { "parentid": proviceid },function (result) {
                    if (result != "") {
                        $("#area").html(result);
                        $('.rule-single-select').ruleSingleSelect();
                   	}
                }, "text");
			}
			
			function getLimitDate(){
				var contractSignDate = $("#contractSignDate").val();
				var contractPeriod = $("#contractPeriod").val();
				$.post("${ctx}/qd/center/getlimitdate", {"contractSignDate":contractSignDate,"contractPeriod":contractPeriod},function (result) {
                    if (result != "") {
                        $("#contractLimitDate").attr("value",result);
                   	}
                }, "text");
			}
		</script>
	</head>
	
	<body class="mainbody">
		<form:form id="inputForm" modelAttribute="center" action="${ctx}/qd/center/save" method="post" class="form-horizontal">
			<form:hidden path="id"/>
			<!--导航栏-->
			<div class="location">
				<a href="${ctx}/qd/center/list" class="back"><i></i><span>返回列表页</span></a>
				<a href="${ctx}/center" class="home"><i></i><span>首页</span></a> 
				<i class="arrow"></i> 
				<a href="${ctx}/qd/center/"><span>早教中心</span></a>
				<shiro:hasPermission name="qd:center:edit"><i class="arrow"></i><span>${not empty center.id ? '修改':'添加' }早教中心</span></shiro:hasPermission>
			</div>	
			<div class="line10"></div>
			<!--/导航栏-->
	
			<!--内容-->
			<div id="floatHead" class="content-tab-wrap">
				<div class="content-tab">
					<div class="content-tab-ul-wrap">
						<ul>
							<li><a class="selected" href="javascript:;">早教中心信息</a></li>
						</ul>
					</div>
				</div>
			</div>
	
			<div class="tab-content">
				<dl>
					<dt>父级中心</dt>
					<dd>
							<div class="rule-single-select single-select">
									<form:select path="parent.id" errormsg="请选择父级中心" sucmsg=" "  >
										<form:option value="0"  label="无父级中心"></form:option>
										<form:options items="${pareCenters}" itemLabel="name" itemValue="id"/>
									</form:select>
							</div>
					</dd>
				</dl>
				<dl>
					<dt>名称</dt>
					<dd>
						<form:input path="name" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入名称" errormsg="请输入名称" sucmsg=" "/>
						<span class="Validform_checktip">*请输入名称</span>
					</dd>
				</dl>
				<dl>
					<dt>虚拟中心</dt>
					<dd>
					<div class="rule-single-select single-select">
						<form:select path="virtual" onchange="getCity();" datatype="*" errormsg="请选择省份" sucmsg=" "  nullmsg="请选择省份" >
							<form:option value=""  selected="selected"  label="请选择..."/>
							<form:option value="0"  label="否"/>
							<form:option value="1"  label="是"/>
						</form:select>
					</div>
					</dd>
				</dl>
				<dl>
					<dt>省份</dt>
					<dd>
					<div class="rule-single-select single-select">
						<form:select id="province" path="province.id" onchange="getCity();" datatype="*" errormsg="请选择省份" sucmsg=" "  nullmsg="请选择省份" >
							<form:option value=""  selected="selected"  label="请选择..."/>
							<form:options items="${provinceList}" itemLabel="name" itemValue="id"/>
						</form:select>
					</div>
					</dd>
				</dl>
				<dl>
					<dt>城市</dt>
					<dd>
					<div class="rule-single-select single-select">
						<form:select id="city" path="city.id"  onchange="getArea();" datatype="*" errormsg="请选择城市" sucmsg=" "  nullmsg="请选择城市"  >
							<form:option value=""  selected="selected"  label="请选择..."/>
							<form:options items="${cityList}" itemLabel="name" itemValue="id"/>
						</form:select>
					</div>
					</dd>
				</dl>
				<dl>
					<dt>区域</dt>
					<dd>
					<div class="rule-single-select single-select">
						<form:select id="area" path="area.id" datatype="*" errormsg="请选择区域" sucmsg=" "  nullmsg="请选择区域"  >
							<form:option value=""  selected="selected"  label="请选择..."/>
							<form:options items="${areaList}" itemLabel="name" itemValue="id"/>
						</form:select>
					</div>
					</dd>
				</dl>
				<dl>
					<dt>店面地址</dt>
					<dd>
						<form:input path="address" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入店面地址" errormsg="请输入店面地址" sucmsg=" "/>
						<span class="Validform_checktip">*请输入店面地址</span>
					</dd>
				</dl>
				<dl>
					<dt>联系电话</dt>
					<dd>
						<form:input path="phone" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入联系电话" errormsg="请输入联系电话" sucmsg=" "/>
						<span class="Validform_checktip">*请输入联系电话</span>
					</dd>
				</dl>
				<dl>
					<dt>教室数量</dt>
					<dd>
						<form:input path="classroomNo" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="/^\d/" nullmsg="请输入教室数量" errormsg="请输入数字" sucmsg=" "/>
						<span class="Validform_checktip">*请输入教室数量</span>
					</dd>
				</dl>
				<dl>
					<dt>中心负责人</dt>
					<dd>
						<form:input path="manager" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入中心负责人" errormsg="请输入中心负责人" sucmsg=" "/>
						<span class="Validform_checktip">*请输入中心负责人</span>
					</dd>
				</dl>
				<dl>
					<dt>投资人</dt>
					<dd>
						<form:input path="investor" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入投资人" errormsg="请输入投资人" sucmsg=" "/>
						<span class="Validform_checktip">*请输入投资人</span>
					</dd>
				</dl>
				<dl>
					<dt>加盟规模</dt>
					<dd>
						<form:input path="scale" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入加盟规模" errormsg="请输入加盟规模" sucmsg=" "/>
						<span class="Validform_checktip">*请输入加盟规模</span>
					</dd>
				</dl>
				<dl>
					<dt>履约保证金</dt>
					<dd>
						<form:input path="surety" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入履约保证金" errormsg="请输入履约保证金" sucmsg=" "/>
						<span class="Validform_checktip">*请输入履约保证金</span>
					</dd>
				</dl>
				<dl>
					<dt>服务管理费</dt>
					<dd>
						<form:input path="serviceFee" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入服务管理费" errormsg="请输入服务管理费" sucmsg=" "/>
						<span class="Validform_checktip">*请输入服务管理费</span>
					</dd>
				</dl>
				<dl>
					<dt>教具款</dt>
					<dd>
						<form:input path="aidFee" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入教具款" errormsg="请输入教具款" sucmsg=" "/>
						<span class="Validform_checktip">*请输入教具款</span>
					</dd>
				</dl>
				<dl>
					<dt>合同编号</dt>
					<dd>
						<form:input path="contractCode" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入合同编号" errormsg="请输入合同编号" sucmsg=" "/>
						<span class="Validform_checktip">*请输入合同编号</span>
					</dd>
				</dl>
				<dl>
					<dt>合同签订日期</dt>
					<dd>
						<fmt:formatDate value="${center.contractSignDate}"  pattern="yyyy-MM-dd" var="contractSignDate"/>
						<form:input  id="contractSignDate"  path="contractSignDate" htmlEscape="false" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});"   maxlength="50" class="required"  cssClass="input normal" datatype="*" nullmsg="请输入合同到期日期" errormsg="请输入合同到期日期" sucmsg=" "  value="${contractSignDate }" />
						<span class="Validform_checktip">*请输入合同签订日期</span>
					</dd>
				</dl>
				<dl>
					<dt>合同期限</dt>
					<dd>
						<form:input id="contractPeriod"  onblur="getLimitDate();"  path="contractPeriod" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入合同期限（例如3、5）" errormsg="请输入合同期限（例如3、5）" sucmsg=" "/>
						<span class="Validform_checktip">*请输入合同期限（例如3、5）</span>
					</dd>
				</dl>
				<dl>
					<dt>合同到期日期</dt>
					<dd>
						<fmt:formatDate value="${center.contractLimitDate}"  pattern="yyyy-MM-dd" var="contractLimitDate"/>
						<form:input id="contractLimitDate" path="contractLimitDate" htmlEscape="false"  maxlength="50" class="required"  cssClass="input normal" datatype="*" nullmsg="请输入合同到期日期" errormsg="请输入合同到期日期" sucmsg=" "  value="${contractLimitDate }"  readOnly="true" />
						<span class="Validform_checktip">*输入合同签订日期和合同期限 系统自动生成</span>
					</dd>
				</dl>
			</div>
			<!--/内容-->
	
			<!--工具栏-->
			<div class="page-footer">
				<div class="btn-wrap">
					<input type="submit" name="btnSubmit" value="提交保存" id="btnSubmit" class="btn" /> 
					<input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript:history.back(-1);" />
				</div>
			</div>
			<!--/工具栏-->
		</form:form>
	</body>
</html>

